﻿function showPic() {
    var length = mapping.length;
    for (var i = 0; i < length; i++) {
        var o = mapping[i];
        var swf = document.getElementById(o.flash);
        if (!swf) continue;
        var width = swf.width;
        var height = swf.height;
        var div = findDiv(swf);
        if (div) {
            div.removeChild(swf);

            var img = document.createElement("img");
            img.src = o.img;
            img.width = width;
            img.height = height;

            div.appendChild(img);
        }
    }
}

function findDiv(obj) {
    while (obj && obj.parentElement != null && obj.parentElement.tagName.toLowerCase() != "div")
        obj = obj.parentElement;

    if (obj)
        return obj.parentElement;
    else
        return null;
}

try {
    var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
    if (!swf)
        showPic();
}
catch (e) {
    showPic();
}